Miles Sound System SDK 7.2a

Callbacks under Nintendo Wii

Discussion

Read this section carefully if you plan to use Miles timer or other callbacks (such as an end-of-sample callback). If you don't intend to use callbacks, then this section won't apply to you.

On the Wii, callbacks are usually made to your application from an alarm interrupt handler. The ideal callback function is one that does nothing more than write to one or two flag variables and then immediately return back to Miles. At interrupt time on the Wii, certain operations are allowed but not recommended -- while other operations are forbidden altogether. The Nintendo documentation is the final authority here.

In any event, if you want to maintain portable code, you should read about the callback restrictions for the other platforms you intend to support.

Remember that all global or static variables that are modified by a callback function must be declared with the volatile modifier. Otherwise, the callback function and the foreground may not be able to communicate after the compiler has performed all of its optimizing tricks.

You should also minimize the total amount of work inside a Miles callback. During a callback, Miles is suspended, so other background tasks won't run - mixing will be interrupted, for example, if you take too long.

Again the best advice for callbacks is to simply post a message or set a flag that can be operated on by your foreground task. This technique works on all platforms and you'll never need to worry about the complications that multithreading or interrupts can cause.

Next Topic (Call Logging under Nintendo)

Previous Topic (Memory management under Nintendo Wii)


Group: Overview for Nintendo Wii
Related FAQs: What's the deal with callbacks - are they threads, interrupts, system timers, or what?

For technical support, e-mail Miles3@radgametools.com
© Copyright 1991-2007 RAD Game Tools, Inc. All Rights Reserved.